(0) Obligation:

Clauses:

q(X, Y) :- m(X, Y, Z).
m(X, 0, X).
m(0, Y, 0) :- !.
m(X, Y, Z) :- ','(p(X, A), ','(p(Y, B), m(A, B, Z))).
p(0, 0).
p(s(X), X).

Query: q(g,g)

(1) PrologToPrologProblemTransformerProof (SOUND transformation)

Built Prolog problem from termination graph ICLP10.

(2) Obligation:

Clauses:

mA(T22, T22).
mA(0, 0).
mA(s(T28), X62) :- mA(T28, X62).
mB(T9, 0, T9).
mB(0, 0, 0).
mB(s(T15), 0, X29) :- mA(T15, X29).
mB(0, T35, 0).
mB(s(T44), s(T48), X94) :- mB(T44, T48, X94).
qC(T5, T6) :- mB(T5, T6, X5).

Query: qC(g,g)

(3) PrologToPiTRSProof (SOUND transformation)

We use the technique of [TOCL09]. With regard to the inferred argument filtering the predicates were used in the following modes:
qC_in: (b,b)
mB_in: (b,b,f)
mA_in: (b,f)
Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

qC_in_gg(T5, T6) → U4_gg(T5, T6, mB_in_gga(T5, T6, X5))
mB_in_gga(T9, 0, T9) → mB_out_gga(T9, 0, T9)
mB_in_gga(0, 0, 0) → mB_out_gga(0, 0, 0)
mB_in_gga(s(T15), 0, X29) → U2_gga(T15, X29, mA_in_ga(T15, X29))
mA_in_ga(T22, T22) → mA_out_ga(T22, T22)
mA_in_ga(0, 0) → mA_out_ga(0, 0)
mA_in_ga(s(T28), X62) → U1_ga(T28, X62, mA_in_ga(T28, X62))
U1_ga(T28, X62, mA_out_ga(T28, X62)) → mA_out_ga(s(T28), X62)
U2_gga(T15, X29, mA_out_ga(T15, X29)) → mB_out_gga(s(T15), 0, X29)
mB_in_gga(0, T35, 0) → mB_out_gga(0, T35, 0)
mB_in_gga(s(T44), s(T48), X94) → U3_gga(T44, T48, X94, mB_in_gga(T44, T48, X94))
U3_gga(T44, T48, X94, mB_out_gga(T44, T48, X94)) → mB_out_gga(s(T44), s(T48), X94)
U4_gg(T5, T6, mB_out_gga(T5, T6, X5)) → qC_out_gg(T5, T6)

The argument filtering Pi contains the following mapping:
qC_in_gg(x1, x2)  =  qC_in_gg(x1, x2)
U4_gg(x1, x2, x3)  =  U4_gg(x3)
mB_in_gga(x1, x2, x3)  =  mB_in_gga(x1, x2)
0  =  0
mB_out_gga(x1, x2, x3)  =  mB_out_gga(x3)
s(x1)  =  s(x1)
U2_gga(x1, x2, x3)  =  U2_gga(x3)
mA_in_ga(x1, x2)  =  mA_in_ga(x1)
mA_out_ga(x1, x2)  =  mA_out_ga(x2)
U1_ga(x1, x2, x3)  =  U1_ga(x3)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x4)
qC_out_gg(x1, x2)  =  qC_out_gg

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog

(4) Obligation:

Pi-finite rewrite system:
The TRS R consists of the following rules:

qC_in_gg(T5, T6) → U4_gg(T5, T6, mB_in_gga(T5, T6, X5))
mB_in_gga(T9, 0, T9) → mB_out_gga(T9, 0, T9)
mB_in_gga(0, 0, 0) → mB_out_gga(0, 0, 0)
mB_in_gga(s(T15), 0, X29) → U2_gga(T15, X29, mA_in_ga(T15, X29))
mA_in_ga(T22, T22) → mA_out_ga(T22, T22)
mA_in_ga(0, 0) → mA_out_ga(0, 0)
mA_in_ga(s(T28), X62) → U1_ga(T28, X62, mA_in_ga(T28, X62))
U1_ga(T28, X62, mA_out_ga(T28, X62)) → mA_out_ga(s(T28), X62)
U2_gga(T15, X29, mA_out_ga(T15, X29)) → mB_out_gga(s(T15), 0, X29)
mB_in_gga(0, T35, 0) → mB_out_gga(0, T35, 0)
mB_in_gga(s(T44), s(T48), X94) → U3_gga(T44, T48, X94, mB_in_gga(T44, T48, X94))
U3_gga(T44, T48, X94, mB_out_gga(T44, T48, X94)) → mB_out_gga(s(T44), s(T48), X94)
U4_gg(T5, T6, mB_out_gga(T5, T6, X5)) → qC_out_gg(T5, T6)

The argument filtering Pi contains the following mapping:
qC_in_gg(x1, x2)  =  qC_in_gg(x1, x2)
U4_gg(x1, x2, x3)  =  U4_gg(x3)
mB_in_gga(x1, x2, x3)  =  mB_in_gga(x1, x2)
0  =  0
mB_out_gga(x1, x2, x3)  =  mB_out_gga(x3)
s(x1)  =  s(x1)
U2_gga(x1, x2, x3)  =  U2_gga(x3)
mA_in_ga(x1, x2)  =  mA_in_ga(x1)
mA_out_ga(x1, x2)  =  mA_out_ga(x2)
U1_ga(x1, x2, x3)  =  U1_ga(x3)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x4)
qC_out_gg(x1, x2)  =  qC_out_gg

(5) DependencyPairsProof (EQUIVALENT transformation)

Using Dependency Pairs [AG00,LOPSTR] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

QC_IN_GG(T5, T6) → U4_GG(T5, T6, mB_in_gga(T5, T6, X5))
QC_IN_GG(T5, T6) → MB_IN_GGA(T5, T6, X5)
MB_IN_GGA(s(T15), 0, X29) → U2_GGA(T15, X29, mA_in_ga(T15, X29))
MB_IN_GGA(s(T15), 0, X29) → MA_IN_GA(T15, X29)
MA_IN_GA(s(T28), X62) → U1_GA(T28, X62, mA_in_ga(T28, X62))
MA_IN_GA(s(T28), X62) → MA_IN_GA(T28, X62)
MB_IN_GGA(s(T44), s(T48), X94) → U3_GGA(T44, T48, X94, mB_in_gga(T44, T48, X94))
MB_IN_GGA(s(T44), s(T48), X94) → MB_IN_GGA(T44, T48, X94)

The TRS R consists of the following rules:

qC_in_gg(T5, T6) → U4_gg(T5, T6, mB_in_gga(T5, T6, X5))
mB_in_gga(T9, 0, T9) → mB_out_gga(T9, 0, T9)
mB_in_gga(0, 0, 0) → mB_out_gga(0, 0, 0)
mB_in_gga(s(T15), 0, X29) → U2_gga(T15, X29, mA_in_ga(T15, X29))
mA_in_ga(T22, T22) → mA_out_ga(T22, T22)
mA_in_ga(0, 0) → mA_out_ga(0, 0)
mA_in_ga(s(T28), X62) → U1_ga(T28, X62, mA_in_ga(T28, X62))
U1_ga(T28, X62, mA_out_ga(T28, X62)) → mA_out_ga(s(T28), X62)
U2_gga(T15, X29, mA_out_ga(T15, X29)) → mB_out_gga(s(T15), 0, X29)
mB_in_gga(0, T35, 0) → mB_out_gga(0, T35, 0)
mB_in_gga(s(T44), s(T48), X94) → U3_gga(T44, T48, X94, mB_in_gga(T44, T48, X94))
U3_gga(T44, T48, X94, mB_out_gga(T44, T48, X94)) → mB_out_gga(s(T44), s(T48), X94)
U4_gg(T5, T6, mB_out_gga(T5, T6, X5)) → qC_out_gg(T5, T6)

The argument filtering Pi contains the following mapping:
qC_in_gg(x1, x2)  =  qC_in_gg(x1, x2)
U4_gg(x1, x2, x3)  =  U4_gg(x3)
mB_in_gga(x1, x2, x3)  =  mB_in_gga(x1, x2)
0  =  0
mB_out_gga(x1, x2, x3)  =  mB_out_gga(x3)
s(x1)  =  s(x1)
U2_gga(x1, x2, x3)  =  U2_gga(x3)
mA_in_ga(x1, x2)  =  mA_in_ga(x1)
mA_out_ga(x1, x2)  =  mA_out_ga(x2)
U1_ga(x1, x2, x3)  =  U1_ga(x3)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x4)
qC_out_gg(x1, x2)  =  qC_out_gg
QC_IN_GG(x1, x2)  =  QC_IN_GG(x1, x2)
U4_GG(x1, x2, x3)  =  U4_GG(x3)
MB_IN_GGA(x1, x2, x3)  =  MB_IN_GGA(x1, x2)
U2_GGA(x1, x2, x3)  =  U2_GGA(x3)
MA_IN_GA(x1, x2)  =  MA_IN_GA(x1)
U1_GA(x1, x2, x3)  =  U1_GA(x3)
U3_GGA(x1, x2, x3, x4)  =  U3_GGA(x4)

We have to consider all (P,R,Pi)-chains

(6) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

QC_IN_GG(T5, T6) → U4_GG(T5, T6, mB_in_gga(T5, T6, X5))
QC_IN_GG(T5, T6) → MB_IN_GGA(T5, T6, X5)
MB_IN_GGA(s(T15), 0, X29) → U2_GGA(T15, X29, mA_in_ga(T15, X29))
MB_IN_GGA(s(T15), 0, X29) → MA_IN_GA(T15, X29)
MA_IN_GA(s(T28), X62) → U1_GA(T28, X62, mA_in_ga(T28, X62))
MA_IN_GA(s(T28), X62) → MA_IN_GA(T28, X62)
MB_IN_GGA(s(T44), s(T48), X94) → U3_GGA(T44, T48, X94, mB_in_gga(T44, T48, X94))
MB_IN_GGA(s(T44), s(T48), X94) → MB_IN_GGA(T44, T48, X94)

The TRS R consists of the following rules:

qC_in_gg(T5, T6) → U4_gg(T5, T6, mB_in_gga(T5, T6, X5))
mB_in_gga(T9, 0, T9) → mB_out_gga(T9, 0, T9)
mB_in_gga(0, 0, 0) → mB_out_gga(0, 0, 0)
mB_in_gga(s(T15), 0, X29) → U2_gga(T15, X29, mA_in_ga(T15, X29))
mA_in_ga(T22, T22) → mA_out_ga(T22, T22)
mA_in_ga(0, 0) → mA_out_ga(0, 0)
mA_in_ga(s(T28), X62) → U1_ga(T28, X62, mA_in_ga(T28, X62))
U1_ga(T28, X62, mA_out_ga(T28, X62)) → mA_out_ga(s(T28), X62)
U2_gga(T15, X29, mA_out_ga(T15, X29)) → mB_out_gga(s(T15), 0, X29)
mB_in_gga(0, T35, 0) → mB_out_gga(0, T35, 0)
mB_in_gga(s(T44), s(T48), X94) → U3_gga(T44, T48, X94, mB_in_gga(T44, T48, X94))
U3_gga(T44, T48, X94, mB_out_gga(T44, T48, X94)) → mB_out_gga(s(T44), s(T48), X94)
U4_gg(T5, T6, mB_out_gga(T5, T6, X5)) → qC_out_gg(T5, T6)

The argument filtering Pi contains the following mapping:
qC_in_gg(x1, x2)  =  qC_in_gg(x1, x2)
U4_gg(x1, x2, x3)  =  U4_gg(x3)
mB_in_gga(x1, x2, x3)  =  mB_in_gga(x1, x2)
0  =  0
mB_out_gga(x1, x2, x3)  =  mB_out_gga(x3)
s(x1)  =  s(x1)
U2_gga(x1, x2, x3)  =  U2_gga(x3)
mA_in_ga(x1, x2)  =  mA_in_ga(x1)
mA_out_ga(x1, x2)  =  mA_out_ga(x2)
U1_ga(x1, x2, x3)  =  U1_ga(x3)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x4)
qC_out_gg(x1, x2)  =  qC_out_gg
QC_IN_GG(x1, x2)  =  QC_IN_GG(x1, x2)
U4_GG(x1, x2, x3)  =  U4_GG(x3)
MB_IN_GGA(x1, x2, x3)  =  MB_IN_GGA(x1, x2)
U2_GGA(x1, x2, x3)  =  U2_GGA(x3)
MA_IN_GA(x1, x2)  =  MA_IN_GA(x1)
U1_GA(x1, x2, x3)  =  U1_GA(x3)
U3_GGA(x1, x2, x3, x4)  =  U3_GGA(x4)

We have to consider all (P,R,Pi)-chains

(7) DependencyGraphProof (EQUIVALENT transformation)

The approximation of the Dependency Graph [LOPSTR] contains 2 SCCs with 6 less nodes.

(8) Complex Obligation (AND)

(9) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

MA_IN_GA(s(T28), X62) → MA_IN_GA(T28, X62)

The TRS R consists of the following rules:

qC_in_gg(T5, T6) → U4_gg(T5, T6, mB_in_gga(T5, T6, X5))
mB_in_gga(T9, 0, T9) → mB_out_gga(T9, 0, T9)
mB_in_gga(0, 0, 0) → mB_out_gga(0, 0, 0)
mB_in_gga(s(T15), 0, X29) → U2_gga(T15, X29, mA_in_ga(T15, X29))
mA_in_ga(T22, T22) → mA_out_ga(T22, T22)
mA_in_ga(0, 0) → mA_out_ga(0, 0)
mA_in_ga(s(T28), X62) → U1_ga(T28, X62, mA_in_ga(T28, X62))
U1_ga(T28, X62, mA_out_ga(T28, X62)) → mA_out_ga(s(T28), X62)
U2_gga(T15, X29, mA_out_ga(T15, X29)) → mB_out_gga(s(T15), 0, X29)
mB_in_gga(0, T35, 0) → mB_out_gga(0, T35, 0)
mB_in_gga(s(T44), s(T48), X94) → U3_gga(T44, T48, X94, mB_in_gga(T44, T48, X94))
U3_gga(T44, T48, X94, mB_out_gga(T44, T48, X94)) → mB_out_gga(s(T44), s(T48), X94)
U4_gg(T5, T6, mB_out_gga(T5, T6, X5)) → qC_out_gg(T5, T6)

The argument filtering Pi contains the following mapping:
qC_in_gg(x1, x2)  =  qC_in_gg(x1, x2)
U4_gg(x1, x2, x3)  =  U4_gg(x3)
mB_in_gga(x1, x2, x3)  =  mB_in_gga(x1, x2)
0  =  0
mB_out_gga(x1, x2, x3)  =  mB_out_gga(x3)
s(x1)  =  s(x1)
U2_gga(x1, x2, x3)  =  U2_gga(x3)
mA_in_ga(x1, x2)  =  mA_in_ga(x1)
mA_out_ga(x1, x2)  =  mA_out_ga(x2)
U1_ga(x1, x2, x3)  =  U1_ga(x3)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x4)
qC_out_gg(x1, x2)  =  qC_out_gg
MA_IN_GA(x1, x2)  =  MA_IN_GA(x1)

We have to consider all (P,R,Pi)-chains

(10) UsableRulesProof (EQUIVALENT transformation)

For (infinitary) constructor rewriting [LOPSTR] we can delete all non-usable rules from R.

(11) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

MA_IN_GA(s(T28), X62) → MA_IN_GA(T28, X62)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
MA_IN_GA(x1, x2)  =  MA_IN_GA(x1)

We have to consider all (P,R,Pi)-chains

(12) PiDPToQDPProof (SOUND transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(13) Obligation:

Q DP problem:
The TRS P consists of the following rules:

MA_IN_GA(s(T28)) → MA_IN_GA(T28)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.

(14) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • MA_IN_GA(s(T28)) → MA_IN_GA(T28)
    The graph contains the following edges 1 > 1

(15) YES

(16) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

MB_IN_GGA(s(T44), s(T48), X94) → MB_IN_GGA(T44, T48, X94)

The TRS R consists of the following rules:

qC_in_gg(T5, T6) → U4_gg(T5, T6, mB_in_gga(T5, T6, X5))
mB_in_gga(T9, 0, T9) → mB_out_gga(T9, 0, T9)
mB_in_gga(0, 0, 0) → mB_out_gga(0, 0, 0)
mB_in_gga(s(T15), 0, X29) → U2_gga(T15, X29, mA_in_ga(T15, X29))
mA_in_ga(T22, T22) → mA_out_ga(T22, T22)
mA_in_ga(0, 0) → mA_out_ga(0, 0)
mA_in_ga(s(T28), X62) → U1_ga(T28, X62, mA_in_ga(T28, X62))
U1_ga(T28, X62, mA_out_ga(T28, X62)) → mA_out_ga(s(T28), X62)
U2_gga(T15, X29, mA_out_ga(T15, X29)) → mB_out_gga(s(T15), 0, X29)
mB_in_gga(0, T35, 0) → mB_out_gga(0, T35, 0)
mB_in_gga(s(T44), s(T48), X94) → U3_gga(T44, T48, X94, mB_in_gga(T44, T48, X94))
U3_gga(T44, T48, X94, mB_out_gga(T44, T48, X94)) → mB_out_gga(s(T44), s(T48), X94)
U4_gg(T5, T6, mB_out_gga(T5, T6, X5)) → qC_out_gg(T5, T6)

The argument filtering Pi contains the following mapping:
qC_in_gg(x1, x2)  =  qC_in_gg(x1, x2)
U4_gg(x1, x2, x3)  =  U4_gg(x3)
mB_in_gga(x1, x2, x3)  =  mB_in_gga(x1, x2)
0  =  0
mB_out_gga(x1, x2, x3)  =  mB_out_gga(x3)
s(x1)  =  s(x1)
U2_gga(x1, x2, x3)  =  U2_gga(x3)
mA_in_ga(x1, x2)  =  mA_in_ga(x1)
mA_out_ga(x1, x2)  =  mA_out_ga(x2)
U1_ga(x1, x2, x3)  =  U1_ga(x3)
U3_gga(x1, x2, x3, x4)  =  U3_gga(x4)
qC_out_gg(x1, x2)  =  qC_out_gg
MB_IN_GGA(x1, x2, x3)  =  MB_IN_GGA(x1, x2)

We have to consider all (P,R,Pi)-chains

(17) UsableRulesProof (EQUIVALENT transformation)

For (infinitary) constructor rewriting [LOPSTR] we can delete all non-usable rules from R.

(18) Obligation:

Pi DP problem:
The TRS P consists of the following rules:

MB_IN_GGA(s(T44), s(T48), X94) → MB_IN_GGA(T44, T48, X94)

R is empty.
The argument filtering Pi contains the following mapping:
s(x1)  =  s(x1)
MB_IN_GGA(x1, x2, x3)  =  MB_IN_GGA(x1, x2)

We have to consider all (P,R,Pi)-chains

(19) PiDPToQDPProof (SOUND transformation)

Transforming (infinitary) constructor rewriting Pi-DP problem [LOPSTR] into ordinary QDP problem [LPAR04] by application of Pi.

(20) Obligation:

Q DP problem:
The TRS P consists of the following rules:

MB_IN_GGA(s(T44), s(T48)) → MB_IN_GGA(T44, T48)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.

(21) QDPSizeChangeProof (EQUIVALENT transformation)

By using the subterm criterion [SUBTERM_CRITERION] together with the size-change analysis [AAECC05] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:

  • MB_IN_GGA(s(T44), s(T48)) → MB_IN_GGA(T44, T48)
    The graph contains the following edges 1 > 1, 2 > 2

(22) YES